package com.boot.security.server.dao.user;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.user.TswUserReation;

@Mapper
public interface TswUserReationDao {

    @Select("select * from tsw_user_reation t where t.id = #{id}")
    TswUserReation getById(Long id);

    @Delete("delete from tsw_user_reation where id = #{id}")
    int delete(Long id);

    int update(TswUserReation tswUserReation);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_user_reation(user_parent_id, user_id, contribution_number, contribution_cash, source_for, create_time, reation_note, reation_remark) values(#{userParentId}, #{userId}, #{contributionNumber}, #{contributionCash}, #{sourceFor}, #{createTime}, #{reationNote}, #{reationRemark})")
    int save(TswUserReation tswUserReation);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswUserReation> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
